package com.eascs.web.o2o.web.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eascs.app.dao.PageResult;
import com.eascs.web.o2o.web.dao.BankLimitDao;
import com.eascs.web.o2o.web.dao.BiodsDao;
import com.eascs.web.o2o.web.entity.BankLimit;
import com.eascs.web.o2o.web.service.BankLimitService;

@Service
public class BankLimitServiceImpl implements BankLimitService {
	@Autowired
	private BankLimitDao bankLimitDao;
	
	@Autowired	
	BiodsDao biodsDao;

	@Override
	public BankLimit insert(BankLimit bankLimit) {
		int effectRow = biodsDao.insert(bankLimit);
		if (effectRow > 0) {
			return bankLimit;
		}
		return null;
	}

	@Override
	public PageResult<Object[]> getBankLimitList(Map<String, String> param, int pageSize, int pageIndex) {
		return bankLimitDao.getBankLimitList(param, pageSize, pageIndex);
	}

	@Override
	public BankLimit getLimit(String bankName) {
		String sql = "SELECT * from ods_o2odev_bank_limit t where t.bank_name = ? and is_delete ='N'";
		return biodsDao.findEntity(sql, BankLimit.class, bankName);
	}

	@Override
	public BankLimit getLimitById(String id) {
		return bankLimitDao.getLimitById(id);
	}

	@Override
	public int update(BankLimit bankLimit) {
		return biodsDao.updateById(bankLimit);
	}

}
